package com.maoshi.shop.mp.comment.uril;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.maoshi.shop.mp.comment.config.bean.WxMp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class WxMpaccesstoken {
    @Autowired
    private WxMp wxMp;

    public String getAccesstoken(){
        Map<String,String> params = new HashMap<String,String>();
        params.put("appid", "wx0764ef80a5584e9a");
        params.put("secret", "16af976ef526455e29f00c7674a7a986");
        params.put("grant_type", "client_credential");
        String url=" https://api.weixin.qq.com/cgi-bin/token";
        String s = HttpGetUtil.httpRequestToString(url, params);
        JSONObject jsonObject = JSON.parseObject(s);
        String access_token = jsonObject.get("access_token").toString();
        return access_token;
    }
}
